<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ul>
      <li>1</li>
      <li>2</li>
      <li>3</li>
      <li>4</li>
    </ul>

    <script>
      const ul = document.body.children[0];
      const li2 = document.body.children[0].children[2];

      console.log(li2.parentElement);
      console.log(li2.previousElementSibling);
      console.log(li2.nextElementSibling);

      console.log(ul.firstElementChild);
      console.log(ul.lastElementChild);
      //   console.log(document.body.childNodes);
      //   console.log(document.body.children[0].children[2]);
    </script>
  </body>
</html>
